package test;

import javax.servlet.*;
import java.io.IOException;
import java.util.Enumeration;

public class CServlet implements Servlet {
    @Override
    public void init(ServletConfig servletConfig)
            throws ServletException {
        //初始化
        System.out.println("C Servlet 第一次使用 初始化了");
//        String name = servletConfig.getInitParameter("name");
//        String age = servletConfig.getInitParameter("age");

        Enumeration<String> keys = servletConfig.getInitParameterNames();
        while (keys.hasMoreElements()){
            String key = keys.nextElement();
            String value = servletConfig.getInitParameter(key);
            System.out.println(key+","+value);        }

    }
    @Override
    public void service(ServletRequest servletRequest,
                        ServletResponse servletResponse)
            throws ServletException, IOException {
        //请求 get put post
        System.out.println("不管你是get 还是post， 其他的都走这个方法处理");
    }

    public void destroy() {
        //销毁
        System.out.println("C Servlet 销毁掉了了");
    }


    @Override
    public ServletConfig getServletConfig() {
        return null;
    }
    @Override
    public String getServletInfo() {
        return null;
    }



}
